package com.slm.krstartimes.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.slm.krstartimes.R;
import com.slm.krstartimes.adapter.GuiderAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dllo on 15/7/10.
 */
public class Guider extends ActionBarActivity {
    private ViewPager viewPager;
    private GuiderAdapter guiderAdapter;
    private List<View> views;
    private TextView start;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.guider_activity);
        initViews();
    }

    /**
     * 初始化
     */
    private void initViews() {
        LayoutInflater inflater = LayoutInflater.from(this);
        views = new ArrayList<>();
        views.add(inflater.inflate(R.layout.guider_1, null));
        views.add(inflater.inflate(R.layout.guider_2, null));
        views.add(inflater.inflate(R.layout.guider_3, null));

        start = (TextView) views.get(2).findViewById(R.id.start);
        start.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent start = new Intent(Guider.this, MainActivity.class);
                startActivity(start);
                finish();
            }
        });
        guiderAdapter = new GuiderAdapter(views, this);
        viewPager = (ViewPager) findViewById(R.id.guider);
        viewPager.setAdapter(guiderAdapter);

    }
}
